layout.tsx 714 B

1234567891011121314151617181920212223242526272829
  1. import { ReactNode } from 'react';
  2. import { notFound } from 'next/navigation';
  3. import { fetchUserProfile } from '@/lib/api/account/profile';
  4. import UserProfileStats from '../_component/UserProfileStats';
  5. import UserProfileTabs from '../_component/UserProfileTabs';
  6. type Props = {
  7. children: ReactNode;
  8. params: Promise<{ sid: string }>;
  9. };
  10. export default async function UserProfileTabsLayout({ children, params }: Props) {
  11. const { sid } = await params;
  12. const res = await fetchUserProfile(sid);
  13. if (!res.success || !res.data) {
  14. notFound();
  15. }
  16. const profile = res.data;
  17. return (
  18. <>
  19. <UserProfileStats profile={profile} />
  20. <UserProfileTabs memberSID={profile.memberSID} />
  21. {children}
  22. </>
  23. );
  24. }